#include <stdio.h>
#include <windows.h>
#include <assert.h>
#pragma warning (disable : 4996)

char * My_Strstr(const char * str1, const char * str2)
{
	assert(str1);
	assert(str2);
	char* p =  (char *)str1;
	if (str2 == 0){
		return NULL;
	}
	while (*p){
		const char * move = p;
		const char * sp = str2;
		while (*move && *sp){
			if (*move == *sp){
				move++;
				sp++;
			}
			else{
				break;
			}
			if (*sp == '\0'){
				return p;
			}
		}
		p++;
	}
}


int main()
{
	char str[] = "This is a simple string";
	char * pch;
	pch = My_Strstr(str, "simple");
	if (pch != NULL)
		strncpy(pch, "sample", 6);
	puts(str);

	system("pause");
	return 0;
}